package com.glsc.ngateway.platform.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.glsc.ngateway.common.api.flowable.resp.ResponseSituationDto;
import com.glsc.ngateway.common.base.domain.mysql.gateway.platform.Appendix;
import com.glsc.ngateway.platform.domain.FlowFormTaskDetail;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.Where;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

@Entity
@Data
public class GiteeDemandDto implements Serializable {

    @ApiModelProperty(value = "流程ID")
    @Id
//    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private String processId;

    @ApiModelProperty(value = "流程创建时间")
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime processCreateTime;

//    @ApiModelProperty(value = "需求发生时间")
//    @Column(name = "demand_happen_time", columnDefinition = "datetime comment '需求发生时间'")
//    @DateTimeFormat(pattern = "yyyy-MM-dd")
//    @JsonFormat(pattern = "yyyy-MM-dd")
//    @JsonSerialize(using = LocalDateSerializer.class)
//    @JsonDeserialize(using = LocalDateDeserializer.class)
//    private LocalDate demandHappenTime;

    /**
     * 流程标题
     */
    @ApiModelProperty(value = "流程标题")
    String processTitle;

    /**
     * 需求标题
     */
    @ApiModelProperty(value = "需求标题")
    String demandTitle;


    /**
     * 发起人姓名
     */
    @ApiModelProperty(value = "发起人姓名")
    String flowCreateOperatorName;

    /**
     * 发起人账号oa
     */
    @ApiModelProperty(value = "发起人账号oa")
    String flowCreateOperatorAccount;

    @ApiModelProperty(value = "发起人部门名称")
    String flowCreatorDepartment;

    /**
     * 系统名称
     */
    @ApiModelProperty(value = "所属系统")
    private String systemName;

    /**
     * 系统代码
     */
    @ApiModelProperty(value = "系统代码")
    private String systemCode;

    /**
     * 系统管理员姓名
     */
    @ApiModelProperty(value = "项目经理姓名")
    private String systemAdminName;


    /**
     *系统管理员账号oa
     */
    @ApiModelProperty(value = "项目经理账号oa")
    private String systemAdminAccount;

    /**
     * 系统管理员姓名
     */
    @ApiModelProperty(value = "系统归属部门")
    private String systemBelongDepartment;

    @ApiModelProperty(value = "需求分类 字典")
    private String demandClass;

    @ApiModelProperty(value = "需求分级 字典")
    private String demandGrade;

    @ApiModelProperty(value = "需求背景")
    private String demandBackground;

    @ApiModelProperty(value = "需求目标")
    private String demandPurpose;

    @ApiModelProperty(value = "需求来源")
    private String demandFrom;

    @ApiModelProperty(value = "需求关联方名称")
    private String demandRelateName;

    @ApiModelProperty(value = "需求关联方账号oa")
    private String demandRelateAccount;

    @ApiModelProperty(value = "需求概述")
    private String demandSummary;

    @ApiModelProperty(value = "需求边界")
    private String demandBoundary;

    @ApiModelProperty(value = "需求风险")
    private String demandRisk;

    @ApiModelProperty(value = "需求详述")
    private String demandDetail;

    @ApiModelProperty(value = "是否立项 字典")
    private String demandSetup;

    @ApiModelProperty(value = "立项结果")
    private String demandGradeExternal;

    @ApiModelProperty(value = "评审人员oa账号")
    @Transient
//    @Column(name = "demand_ok_account", columnDefinition = "varchar(10) comment '评审人员oa账号'")
    private List<String> demandOkAccountList;

    @ApiModelProperty(value = "是否需要OA合规评审")
    private String demandNeedOaOk;

    @ApiModelProperty(value = "OA合规评审流程")
    private String demandOaOkTitle;

    @ApiModelProperty(value = "OA合规评审结果")
    private String demandOaOkResult;

    @ApiModelProperty(value = "所需工时")
    private String demandWorkTime;

    @ApiModelProperty(value = "需求设计评审人员账号")
    @Transient
//    @Column(name = "demand_result", columnDefinition = "Text comment '需求设计评审人员'")
    private List<String> demandDesignAccountList;

    @ApiModelProperty(value = "需求文件")
    private String demandDocIdList;

    @ApiModelProperty(value = "需求文件")
    @Transient
    private List<Appendix> demandDocList;

    @ApiModelProperty(value = "设计文件")
    private String demandDesignDocIdList;

    @ApiModelProperty(value = "设计文件")
    @Transient
    private List<Appendix> demandDesignDocList;

    @ApiModelProperty(value = "测试用例文件")
    private String demandTestInstanceDocIdList;

    @ApiModelProperty(value = "测试用例文件")
    @Transient
    private List<Appendix> demandTestInstanceDocList;

    @ApiModelProperty(value = "测试报告文件")
    private String demandTestReportDocIdList;

    @ApiModelProperty(value = "测试报告文件")
    @Transient
    private List<Appendix> demandTestReportDocList;

    @ApiModelProperty(value = "部署文件")
    private String demandOnlineDocIdList;

    @ApiModelProperty(value = "部署文件")
    @Transient
    private List<Appendix> demandOnlineDocList;

    @ApiModelProperty(value = "是否完成 ")
    private int isClose = 0;

    @ApiModelProperty(value = "是否删除 ")
    private int isDelete = 0;

    @ApiModelProperty(value = "创建时间")
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime insertTime;

    @ApiModelProperty(value = "更新时间")
    @org.hibernate.annotations.UpdateTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime updateTime;


    /**
     *
     * TODO 暂时这样
     * * * * */
    public static GiteeDemandDto instance(ResponseSituationDto r) {
        return new GiteeDemandDto();
    }

    /**
     * 整改措施
     */
    @ApiModelProperty(value = "任务明细")
    List<FlowFormTaskDetail> detail;
}
